package br.unifor.cct.mia.evaluate.classification;

import weka.classifiers.Classifier;
import weka.classifiers.bayes.NaiveBayes;
import weka.classifiers.functions.MultilayerPerceptron;
import weka.classifiers.lazy.IBk;
import weka.classifiers.meta.Bagging;
import weka.classifiers.rules.PART;
import weka.classifiers.trees.J48;
import weka.gui.explorer.ClassifierPanel;
import br.unifor.cct.mia.evaluate.Evaluate;

public class WekaClassificationBagging extends WekaClassifier {

	public WekaClassificationBagging(Integer classifType, String[] options) {
		super(classifType,options);
		panel = new ClassifierPanel();
		
		Bagging bagging = new Bagging();
		Classifier classifier = null;
		if ( classifType.intValue() == Evaluate.J48.intValue() )
			classifier = new J48();
		else if ( classifType.intValue() == Evaluate.MULTILAYER_PERCEPTRON.intValue() )
			classifier = new MultilayerPerceptron();
		else if ( classifType.intValue() == Evaluate.MULTILAYER_PERCEPTRON.intValue() ) 
			classifier = new MultilayerPerceptron();
		else if ( classifType.intValue() == Evaluate.NAIVE_BAYES.intValue() )
			classifier = new NaiveBayes();
		else if ( classifType.intValue() == Evaluate.IBK.intValue() )
			classifier = new IBk();		
		else if ( classifType.intValue() == Evaluate.PART.intValue() )
			classifier = new PART();

		if ( options != null ) {
			try {
				classifier.setOptions(options);
			} catch (Exception e) {		
				e.printStackTrace();
			}
		}		
		
		bagging.setClassifier(classifier);
		panel.m_ClassifierEditor.setValue(bagging);				
	}	
}
